export class StorageBase<T> {
    key!: string
    constructor(key: string) {
        this.key = key
    }
    set(t: T) {
        const json = JSON.stringify(t)
        localStorage.setItem(this.key, json)
    }
    get() {
        const t = localStorage.getItem(this.key)
        if (t == null) {
            return null
        }
        return JSON.parse(t) as T
    }
    remove() {
        localStorage.removeItem(this.key)
    }
}
